package com.stx.blog.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;

import com.stx.blog.dao.BlogCellectDao;
import com.stx.blog.entity.BlogCellectEntity;
import com.stx.blog.service.BlogCellectService;
import com.stx.blog.vo.BlogCellectVo;

public class BlogCellectServiceImpl implements BlogCellectService{
	
	private static final Object BlogCellectEntity = null;
	private BlogCellectDao dao=null;

	public List<BlogCellectVo> list(BlogCellectVo criteria){
		
		List<BlogCellectVo> voList=new ArrayList<BlogCellectVo>();
		
		List<BlogCellectEntity> entityList=dao.list(criteria);
		
		
		for(BlogCellectEntity entity : entityList){
			
			BlogCellectVo vo=new BlogCellectVo();
			
			// 对象属性值拷贝 entity => vo
						BeanUtils.copyProperties(entity, vo);

						voList.add(vo);

			
		}
		return voList;
	}

	@Override
	public void delBlogCellect(String cno) {
		
		dao.delBlogCellect(cno);
	}

	@Override
	public void addBlogCellect(BlogCellectVo BlogCellect) {
		
		dao.addBlogCellect(BlogCellect);
	}

	@Override
	public BlogCellectVo findBlogCellectForUpdate(String cno) {
		
		BlogCellectVo blogCellectVo=new BlogCellectVo();
		
		// 对象属性值拷贝 entity => vo
				BeanUtils.copyProperties(BlogCellectEntity, blogCellectVo);
				
		return blogCellectVo;
		
	}

	public void setDao(BlogCellectDao dao) {
		this.dao = dao;
	}
}
